package com.cyw.product;

import org.springframework.kafka.core.KafkaTemplate;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

/**
 * @Author: Chenyw
 * @Date: 2022/11/09/15:52
 */
@Service
public class KafkaProducer {

    @Resource
    private KafkaTemplate<String,Object> kafkaTemplate;

    public void sendMessageToMoments(){
        String msg = "hello";
        kafkaTemplate.send("moments_topic",msg);
    }

    public void sendMessageToUser(String msg){
        kafkaTemplate.send("user_topic",msg);
    }
}
